#ifndef _IO_CPARSER_H_
#define _IO_CPARSER_H_

class CParser
{
private:
	char *data;
	int dataLen;
	int dataPos;

	bool isTokenChar(char c);
	bool isWhiteChar(char c);
public:
	enum {MAX_FILE_SIZE=1*1024*1024};
	enum {PARSER_CONTINUE=0, ERR_FILENOTFOUND, ERR_FILETOOBIG, ERR_PARSEERROR, ERR_ENDOFFILE};

	CParser();
	~CParser();

	int open(const char *fname);

	int tokenLen();
	int readToken(char *buf, int maxLen);
	char *readToken();

	int skipComments();
	int skipWhiteSpace();
	int skipAll();

	bool eof();
	bool hasMore(int c=1);
};

#endif //_IO_CPARSER_H_